package net;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.net.Socket;
import java.util.Scanner;

public class Client1 {
    public static void main(String[] args){
        try {
            Socket socket=new Socket("192.168.1.110",9999);
            System.out.println("客户端连接成功！");
            new Receiver(socket).start();
            OutputStreamWriter osw=new OutputStreamWriter(socket.getOutputStream());
            BufferedWriter bw=new BufferedWriter(osw);
            Scanner kb=new Scanner(System.in);
            String mess=kb.nextLine();
            while (!mess.equals("bye")){
                osw.write(mess+"\n");
                osw.flush();
                mess=kb.nextLine();
            }
            osw.close();
            kb.close();

        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
